package com.sykj.bsc.zn.mapper;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.sykj.bsc.rwl.po.SysMenu;
import com.sykj.bsc.zjj.bean.Bis_shop_post;
import com.sykj.bsc.zn.bean.Bis_beauty_record;
import com.sykj.bsc.zn.bean.Bis_business_order;
import com.sykj.bsc.zn.bean.Bis_cash_record;
import com.sykj.bsc.zn.bean.Bis_shop;
import com.sykj.bsc.zn.bean.Bis_shop_user;
import com.sykj.bsc.zn.bean.FinanceUser;

public interface znmapper {
	/**
	 * 商家
	 * @param shop_user
	 * @return
	 */
	public List<Map> finduser_shop(Bis_shop_user shop_user);
	
	@Delete("delete from Bis_shop_user where shop_id =#{shop_id}")
	public void deleteshop_user(int shop_id);
	
	public List<Map> findshop1(Bis_shop shop);
	
	//验证手机号是否重复
	@Select("select * from bis_shop_user where mobile =#{mobile}")
	public Bis_shop_user judgemobile(String mobile);
	
	@Select("select * from bis_shop")
	public List<Bis_shop>findshop2();
	
	@Insert("insert into bis_shop_user values(#{shop_user_id},'2',#{shop_id},#{account},#{username},#{password},null,null,null,#{post_code},now(),#{mobile},null,#{email},null,#{idno},null,null,null,#{status},null,null,now(),null,now(),null)")
	public void insertshopuser(Bis_shop_user shopuser);
	
	@Delete("delete from bis_shop_user where shop_user_id=#{shop_user_id}")
	public void deleteshopuser1(String shop_user_id);
	
	@Select("select * from bis_shop_user where shop_user_id =#{shop_user_id}")
	public Bis_shop_user toupdateshop(String shop_user_id);
	
	@Update("update bis_shop_user set status=#{status},account=#{account},username=#{username},mobile=#{mobile},phone=#{phone},email=#{email},idno=#{idno},modify_time=now() where shop_user_id =#{shop_user_id}")
	public void updateshopuser(Bis_shop_user shopuser);
	
	
	@Delete("delete from bis_shop where shop_id=#{shop_id}")
	public void deleteshop(int shop_id);
	

	//查询身份为店主的用户
	@Select("select * from bis_shop_user where user_type='1'")
	public List<Map> findshopuserBytype(String user_type);
	
	@Insert("insert into bis_shop values(null,#{owner_id}, #{shop_name}, #{short_name}, #{month_cash_in}, #{month_expend_in}, #{shop_license}, #{shop_image}, #{shop_detail_image}, null, NULL, null, '湖北省襄阳市', null, #{shop_phone}, 100.00, null,#{shop_project}, NULL, '0', '0', NULL, '09:00', '21:00', now(), NULL, now(), NULL)")
	public void insertshop(Bis_shop shop);
	
	@Select("select * from bis_shop where shop_id =#{shop_id}")
	public Bis_shop toupdateshop2(int shop_id);
	
	@Update("update bis_shop set shop_name=#{shop_name},short_name=#{short_name},shop_image=#{shop_image},shop_detail_image=#{shop_detail_image},shop_project=#{shop_project},show_status=#{show_status},modify_time=now(),month_cash_in=#{month_cash_in},month_expend_in=#{month_expend_in},shop_address=#{shop_address},shop_phone=#{shop_phone} where shop_id=#{shop_id}")
	public void updateshop (Bis_shop shop);
	
	
	//修改密码
	@Update("update bis_shop_user set password=#{password} where shop_user_id =#{shop_user_id}")
	public void updatepassword(Bis_shop_user shopuser);
	
	

	
	/**
	 * 财务
	 * @param cashrecord
	 * @return
	 */
	

	
	public List<Map> findcashrecord(Bis_cash_record cashrecord);
	
	@Delete("delete from bis_cash_record where record_id=#{record_id}")
	public void deletecash(String record_id);
	
	public List<Map> findbeautyrecord(Bis_beauty_record beaurtyrecord);
	
	public List<Map> findshop(Bis_shop shop);

	
	public Bis_business_order findbusinessorder();
	
	public List<Map>  findshopandorder(int shop_id);
	
	public List<Map> findorderanduser(Bis_business_order order);
	
	public List<Map> findshopuserpostbusiness(Map map);
	
	@Select("SELECT SUM(manual_price) mp,sum(cash_income) ci,sum(extend_income) ei, bo.SERVER_user_id  FROM  bis_nurse_project bnp,bis_business_order bo WHERE bnp.project_id=bo.project_id  ")
	public  List<Map> findproject();
	
	
	
	/**
	 * 创建人：池磊
	 * 用途：找店铺
	 * @return
	 */
	public List<Bis_shop> selectBis_shop();
	/**
	 * 创建人：池磊
	 * 用途：根据id找店铺
	 * @return
	 */
	public Bis_shop getBis_shopByid(String shop_id);
	
	public String findAccount(String mobile);
	
	/**
	 * 任文龙 修改密码
	 */
	public int updatePassword(@Param("password") String password,@Param("mobile")String mobile,@Param("account")String account);
	
	
	//前台首页
	public List<Map> findQt(HashMap<String, Object> map);
	
	public String findPost_name(String post_code);
	
	public String findPost_code(@Param("shop_id")String shop_id,@Param("owner_id")String owner_id);
	public List<SysMenu> find_Bis_shop_Post();
	
	//店面
	public Map finddianmian(String ship_id);
	
	//判断用户名是否存在
	@Select("select count(1) from bis_shop_user where account=#{account}")
	public int checkAccount(String account);
	//判断手机是否存在
	@Select("select count(1) from bis_shop_user where mobile=#{mobile}")
	public int checkMobile(String mobile);
	
	//填充下拉框
	@Select("select post_id,post_name,post_code from bis_shop_post")
	public List<Bis_shop_post> selectBis_shop_post();
	
	
	
	
	
	
	
//张诺前台财务
	
    //查询前台财务总况
	public List<Map> findbisinessordel(Bis_business_order businessorder);
	//查询财务完成率
	public Bis_business_order findgetorder(Map map);

	//查询员工
	public  List<Map> findfinanceuser( Bis_shop_user shopuser);
	//查询员工手工费
	public Bis_shop_user findgetfinanceuser(Map map);
	
	//*******************************************
		//查询员工
		public  List<FinanceUser> listfinanceuser(Map map);
		//查询员工手工费
		public FinanceUser getfinanceuser(Map map);

}
